package com.fsy.spring.observer;

import java.util.Objects;

/**
 * Created by shuangyu.feng on 2017/7/27.
 */
public class Observer implements IObserver{
	private String name;

	public Observer(String name){
		this.name = name;
	}
	public void sendMessage() {
		System.out.println(name + " has reload page!");
	}

	@Override
	public int hashCode(){
		int code = 1;
		code = code*31 + name.hashCode();
		return code;
	}

	@Override
	public boolean equals(Object obj){
		return Objects.equals(((Observer) obj).name,this.name);
	}
}
